import numpy as np
from scipy.stats import logistic


def identity(x, offset):
  return x + offset


def logistic_normalize(x, factor):
  x0 = 2.0 * logistic.cdf(x * factor) - 1.0
  return x0


def z_normalize(x, mu, sigma):
  return (x - mu) / sigma


def signed_log(x):
  if x >= 0:
    x0 = np.log(1. + x)
  else:
    x0 = -np.log(1. - x)
  return x0